﻿using System;
using System.Collections.Generic;
using System.IO;

namespace Ue.Web
{
    public interface IVirtualPathProvider
    {
        string Combine(params string[] paths);
        string ToAppRelative(string virtualPath);
        string MapPath(string virtualPath);

        bool FileExists(string virtualPath);
        bool TryFileExists(string virtualPath);
        Stream OpenFile(string virtualPath);
        StreamWriter CreateText(string virtualPath);
        Stream CreateFile(string virtualPath);
        DateTime GetFileLastWriteTimeUtc(string virtualPath);
        string GetFileHash(string virtualPath);
        string GetFileHash(string virtualPath, IEnumerable<string> dependencies);

        bool DirectoryExists(string virtualDir);
        void CreateDirectory(string virtualDir);
        string GetDirectoryName(string virtualPath);

        //void Delete(string virtualPath);
        //void Delete(string virtualPath, bool recursive);

        /// <summary>
        /// 根据虚拟目录路径，检索并返回目录下的文件虚拟路径集合
        /// </summary>
        /// <param name="virtualDir">目录虚拟路径</param>
        /// <returns>返回：文件虚拟相对路径集合</returns>
        IEnumerable<string> ListFiles(string virtualDir);
        /// <summary>
        /// 根据虚拟目录路径，检索并返回子目录虚拟路径集合
        /// </summary>
        /// <param name="virtualDir">目录虚拟路径</param>
        /// <returns>返回：子目录相对路径集合</returns>
        IEnumerable<string> ListDirectories(string virtualDir);
    }
}
